home *** CD-ROM | disk | FTP | other *** search
- ' a class for our reflection tests
-
- Class Person
- ' Some public and private fields
- Public FirstName As String
- Public LastName As String
-
- Dim m_Age As Short
- Dim m_EmailAddress(4) As String
-
- Sub New()
- MyBase.New()
- End Sub
-
- ' A constructor with parameters
- Sub New(ByVal FirstName As String, ByVal LastName As String)
- MyBase.New()
- Me.FirstName = FirstName
- Me.LastName = LastName
- End Sub
-
- ' A read-write property
- Property Age() As Short
- Get
- Return m_Age
- End Get
- Set(ByVal Value As Short)
- m_Age = Value
- End Set
- End Property
-
- ' A property with arguments
- Property EmailAddress(ByVal Index As Short) As String
- Get
- Return m_EmailAddress(Index)
- End Get
- Set(ByVal Value As String)
- m_EmailAddress(Index) = Value
- End Set
- End Property
-
- ' A method with optional arguments
- Sub SendEmail(ByVal msg As String, Optional ByVal Priority As Integer = 1)
- ' ... (No real code in this demo)...
- Console.WriteLine("Message to " & FirstName & " " & LastName)
- Console.WriteLine("Priority = " & Priority.ToString)
- Console.WriteLine(msg)
- End Sub
- End Class
-